<?php

require_once 'PHPUnit/Framework.php';

CCore::Using('mime.parameter');

/**
 * Test class for CCoreMimeParameter.
 */
class CCoreMimeParameterTest extends PHPUnit_Framework_TestCase
{
	/**
	 * @var CCoreMimeParameter
	 */
	protected $object;

	/**
	 * This method is called before a test is executed.
	 */
	protected function setUp()
	{
		$this->object = new CCoreMimeParameter('Key', 'Value');
	}

	public function testName()
	{
		$this->assertEquals('Key', $this->object->Name());
	}

	public function testValue()
	{
		$this->assertEquals('Value', $this->object->Value());
	}

	public function testParse0()
	{
		$this->object->Parse('New = Help');
		$this->assertEquals('New', $this->object->Name());
		$this->assertEquals('Help', $this->object->Value());
	}

	public function testParse1()
	{
		$this->object->Parse('New: Help', ':');
		$this->assertEquals('New', $this->object->Name());
		$this->assertEquals('Help', $this->object->Value());
	}

	public function testParse2()
	{
		$this->object->Parse('email=new@domain.com=remark', '=');
		$this->assertEquals('email', $this->object->Name());
		$this->assertEquals('new@domain.com=remark', $this->object->Value());
	}
}
